<template>
  <div class="white-module teacher-evaluation-module">
    <div style="height: 1px"></div>
    <div class="evaluate">
      <div class="text-name">
        <div class="text">{{ classRoom.classRoomEntity.title }}</div>
        <div class="img">
          <img src="@/assets/common/active_learn.png" /> {{ classRoom.courseEntity.title }}
        </div>
      </div>
      <div class="excel">返回课堂</div>
    </div>

    <div class="student">
      <div class="num-total">
        <div class="num">学生：{{classRoom.userInfo.account}}</div>
        <div class="total">选择题 1/2 评星题</div>
      </div>
<!--      <div class="excel">导出全部</div>-->
    </div>
    <div class="grading global-scroll">
      <div class="item" v-for="(item, index) in topicArray.items" :key="index">
        <div class="title">{{ index + 1 }}. {{ item.title }}</div>
        <div class="answer-module">
          <div v-if="item.type == 1" class="input">
            <el-input type="text" placeholder="请填写答案"></el-input>
          </div>
          <div v-if="item.type == 2" class="radio">
            <el-radio-group class="" v-model="item.answer">
              <div>
                <div v-for="(e, num) in item.options" :key="num">
                  <el-radio :label="e.id">{{ e.option }}</el-radio>
                </div>
              </div>
            </el-radio-group>
          </div>
          <div v-if="item.type == 3" class="checkbox">
            <el-checkbox-group v-model="item.answer">
              <div>
                <div v-for="(e, num) in item.options" :key="num">
                  <el-checkbox :label="e.option" :value="e.id" />
                </div>
              </div>
            </el-checkbox-group>
          </div>
          <div v-if="item.type == 4" class="five">
            <img src="@/assets/classroom/active_five.png" />
            <img src="@/assets/classroom/active_five.png" />
            <img src="@/assets/classroom/active_five.png" />
            <img src="@/assets/classroom/five.png" />
          </div>
          <div v-if="item.type == 5" class="textarea">
            <el-input
              type="textarea"
              rows="3"
              placeholder="请填写答案"
            ></el-input>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { ref, Ref, nextTick,defineProps } from "vue";

/**
 * 接收父组件传来的值
 */
const props = defineProps({
  classRoom: {}
});

const topicArray: any = ref({
  id: 1,
  title: "评价一",
  creator: "zhangsan",
  create_at: "2022-04-08 10:00:00",
  updator: "zhangsan",
  update_at: "2022-04-08 10:00:00",
  items: [
    {
      id: 1,
      title: "请输入内容 type=1 填空题",
      type: 1,
      sort: 1,
      answer: "标准答案",
      creator: "zhangsan",
      create_at: "2022-04-08 10:00:00",
      updator: "zhangsan",
      update_at: "2022-04-08 10:00:00",
    },
    {
      id: 2,
      title: "请选择正确答案-type=2 单选题",
      type: 2,
      options: [
        {
          id: 1,
          option: "选项一",
        },
        {
          id: 2,
          option: "选项二",
        },
      ],
      sort: 2,
      answer: 1,
      creator: "zhangsan",
      create_at: "2022-04-08 10:00:00",
      updator: "zhangsan",
      update_at: "2022-04-08 10:00:00",
    },
    {
      id: 3,
      title: "请选择正确答案  type=3 多选题",
      type: 3,
      options: [
        {
          id: 1,
          option: "选项一",
        },
        {
          id: 2,
          option: "选项二",
        },
      ],
      sort: 3,
      answer: ["选项一"],
      creator: "zhangsan",
      create_at: "2022-04-08 10:00:00",
      updator: "zhangsan",
      update_at: "2022-04-08 10:00:00",
    },
    {
      id: 4,
      title: "请评分 type=4 评分题",
      type: 4,
      options: [
        {
          id: 1,
          score: 1,
          option: "分值一",
        },
        {
          id: 2,
          score: 2,
          option: "分值二",
        },
      ],
      sort: 4,
      answer: "5",
      creator: "zhangsan",
      create_at: "2022-04-08 10:00:00",
      updator: "zhangsan",
      update_at: "2022-04-08 10:00:00",
    },
    {
      id: 5,
      title: "请输入答案 type=5 简答题",
      type: 5,
      sort: 5,
      answer: "标准答案",
      creator: "zhangsan",
      create_at: "2022-04-08 10:00:00",
      updator: "zhangsan",
      update_at: "2022-04-08 10:00:00",
    },
  ],
});


</script>
<style scoped lang="scss">
.teacher-evaluation-module {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 0px;
}
.grading {
  flex: auto;
  overflow-y: auto;
  margin-top: 12px;
  padding: 12px 24px 8px;
  .item {
    margin-bottom: 24px;
    .title {
      font-weight: bold;
      font-size: 16px;
      margin-bottom: 16px;
    }
    .input,
    .radio,
    .checkbox,
    .five,
    .textarea {
      padding-left: 20px;
    }
    .five {
      display: flex;
      align-items: center;
      img {
          cursor: pointer;
        width: 20px;
        height: 20px;
        margin-right: 8px;
      }
    }
    .radio,
    .checkbox {
      margin-top: -6px;
    }
  }
}
.student {
  margin: 26px 24px 0px;
  flex-shrink: 0;
  border-bottom: 1px solid #eeeeee;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-bottom: 12px;
  justify-content: space-between;
  .num-total {
    text-align: left;
    .num {
      font-weight: bold;
      font-size: 18px;
    }
    .total {
      font-size: 12px;
      display: flex;
      align-items: center;
      margin-top: 8px;
      color: #4f5a70;
    }
  }
  .excel {
    cursor: pointer;
    width: 68px;
    line-height: 28px;
    background: #00a0e9;
    border-radius: 6px;
    font-size: 12px;
    color: #fff;
    text-align: center;
  }
}
.evaluate {
  margin: 23px 24px 0px;
  height: 80px;
  flex-shrink: 0;
  background: #eff6ff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0px 16px;
  justify-content: space-between;
  .text-name {
    text-align: left;
    .text {
      font-weight: bold;
      font-size: 18px;
    }
    .img {
      font-size: 14px;
      display: flex;
      align-items: center;
      margin-top: 8px;
      img {
        width: 18px;
        margin-right: 5px;
        height: 18px;
        margin-top: 2px;
      }
    }
  }
  .excel {
    cursor: pointer;
    width: 104px;
    line-height: 38px;
    background: #00a0e9;
    border-radius: 6px;
    font-size: 16px;
    color: #fff;
    text-align: center;
  }
}
</style>
